package com.atguigu.lease.common.minioClient;

import com.atguigu.lease.common.minioProperties.MinioMyProperties;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@EnableConfigurationProperties(MinioMyProperties.class)
@Configuration
public class MinioClientProperties {

    @Autowired
    private MinioMyProperties properties;
    @Bean
    public MinioClient getMinioClient() {
        MinioClient minioClients = MinioClient.builder()
                .endpoint(properties.getEndPoint())
                .credentials(properties.getUserName(), properties.getPassword())
                .build();
        return minioClients;
    }


}
